﻿namespace BusinessLogicLayer
{
    using System;

    /// <summary>
    /// Class that gives access to BusinessLogicLayer. 
    /// It has a static method, that
    /// can create different dashboards by LayerType parameter
    /// </summary>
    public static class DashBoardManager
    {
        /// <summary>
        /// The single method of this class, that
        /// return specific IDashBoard object by LayerType parameter
        /// </summary>
        /// <param name="layerType">specify the type of DashBoard</param>
        /// <returns>IDashBoard object</returns>
        public static IDashBoard CreateDashBoard(LayerType layerType)
        {
            switch (layerType)
            {
                case LayerType.TasksDashBoard:
                    TasksDashBoard tasksDashBoard = new TasksDashBoard();
                    tasksDashBoard.GetAllItemsList();
                    tasksDashBoard.RenderColumns();
                    return tasksDashBoard; 

                case LayerType.ProjectsDashBoard:
                    return new ProjectsDashBoard();

                case LayerType.UserStoriesDashBoard:
                    return new UserStoriesDashBoard();

                default:
                    throw new Exception("Creation failed!");
            }
        }
    }
}
